package com.bdv.md.dao.impl;

import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.bdv.md.dao.TransactionHistoryDao;
import com.bdv.md.model.TransactionHistory;

@Repository
public class TransactionHistoryDaoImpl extends AbstractDaoImpl<TransactionHistory, Integer> implements TransactionHistoryDao{

	protected TransactionHistoryDaoImpl() {
		super(TransactionHistory.class);
	}

	public TransactionHistory getTransactionHistoryByTxID(String txId) {
		Criterion criterion = Restrictions.eq("txId", txId);
		List<TransactionHistory> list = findByCriteria(criterion);
		return !list.isEmpty() ? findByCriteria(criterion).get(0) : null;
	}

}
